package com.lsk.util;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayFundTransToaccountTransferRequest;
import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;

public class LuhaoyuanAlipayTest {



    public static void main(String args[]){
        String appId ="2016093000629843";
        String gate="https://openapi.alipaydev.com/gateway.do";
        String privatekey="MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCVHjkcZR/JXqLj5qEpEcVLZfodFqJEArP3V309QFr7XScx9iWWHpfJREhdBuMWnPpZ9UH64zQj44oezT3M0MGy5+mAyfsChWBovZMe+mTqZMpdiOkU8MpaVBvabY2MUy1DpjMBAjV0U/8vO7tI5moPJr/C0kOLNWQr6C2pQLl38mvutsgIDBvvkvHkrbB2Qhz2rbVmNH4ei4z3ZxBQUwVB06Nfq/AVclfFE/pj2a1zhALYZUuWefjaTnXcuQuFQYg8QeouOHk/OI0UI9gDd0+PnbMH/PdCmMJOm+cgPyyxIZozhEOcwB1hbLFXkPVGPpFtNKpq09jSPzpenvhEO8qZAgMBAAECggEAXuyhYHEDPhXvTXKIDvPQC0I8aH37B55M39wiznYENNVE2SofHSQWbbn48rcqoj+FovRcbxBpJZt4VklC2PnfBDtbSm/JSP6Ms8BSQjsVOJy2sbow3fK2ba/zFyX8IGLmgpTvDOpSCt5ZqMC2ZR7ATyrUkXl2I8z2Gnkvb/nS1wZK/PvMrpT5dOQ/1cdgeb/YzaukNATbyjOvrkbxSFuyko+bFjik8s6no276pusJhk9UwBMWsirhrcSUH0lu1lIOV/elc3kJvCMvZDxsaZcwVCB9rl+59lZi4BPygPC62KlbUnPv+0X293aII34rsdu0cvNhgDZ3JJxbOqJBOWJAfQKBgQD9UEVXHvryslOVv6ZQfQ+9RzICMfHlnWkQLWqjBG7u5AJT1CucB1Bw0ENBMG3V6iNcy2vx3ybmjMv8P3ks03o8RmmuMlKF8IrKqVD7/7QPnZfLeY2naJHBQbLx5uDm+09x6MT36zpN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QpjCTpvnID8ssSGaM4RDnMAdYWyxV5D1Rj6RbTSqatPY0j86Xp74RDvKmQIDAQAB";
        AlipayClient alipayClient = new DefaultAlipayClient(gate,appId,privatekey,"json","utf-8",publicKey,"RSA2");
        AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest();
        request.setBizContent("{" +
                "    \"out_biz_no\":\"3142312123\"," +
                "    \"payee_type\":\"ALIPAY_LOGONID\"," +
                "    \"payee_account\":\"inctxl3502@sandbox.com\"," +
                "    \"amount\":\"1\"," +
                "    \"payer_show_name\":\"上海交通卡退款\"," +
                "    \"payee_real_name\":\"沙箱环境\"," +
                "    \"remark\":\"转账备注\"," +

                "  }");
        AlipayFundTransToaccountTransferResponse response=null;
        try{
         response= alipayClient.execute(request);
        }catch(Exception e){
            System.out.println(response.getMsg());
        }

    }
}
